package com.qd.common.sys.domain.entity.station;

import com.cdqidi.valid.group.DefaultGroup;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;
import java.util.List;
import java.util.Optional;

/**
 * @author sjk
 */
@Data
@Accessors(chain = true)
public class StationOrgAllDTO {
    @NotBlank(message = "职责ID不能为空", groups = DefaultGroup.class)
    @Size(max = 50, message = "职责长度不能超过{max}位", groups = DefaultGroup.class)
    private String stationId;

    @NotEmpty(message = "机构ID集合不能为空", groups = DefaultGroup.class)
    private List<String> orgIds;

    public void freeData() {
        this.stationId = null;
        Optional.ofNullable(orgIds).ifPresent(List::clear);
    }
}